<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>

  <script src=" https://cdn.bootcss.com/jquery.form/4.2.2/jquery.form.js"></script>
  <script type="text/javascript" src="js/qiniu.min.js"></script>

</head>
<body>
<form method="post" enctype="multipart/form-data" id="imgform">
  <input type="file" name="myfile" id="myfile">
</form>

<div id="preview">
</div>

<script type="text/javascript" >

  $('#myfile').change( function() {
    $("#imgform").ajaxSubmit({
      url: "qiniutest/upload",
      method: 'POST',
      datType: 'json',
      success: function (data) {
        console.log(data.imgUrl);
        // var ele = "<img src=\"\"/>"
        // $("#preview").append(ele);
        // $("#preview").find("img").attr("src",data.imgUrl);
      },
      error: function (data) {
        alert(data);
      }
    })
  })
</script>
</body>
</html>